package stage_one;
import com.opensymphony.xwork2.Action;
import com.opensymphony.xwork2.ActionContext;


public class GetBookAction implements Action{
	private String[] books ;

	public String[] getBooks() {
		return books;
	}

	public void setBooks(String[] books) {
		this.books = books;
	}
	
	public String execute() {
		String user = (String) ActionContext.getContext().getSession().get("user");
		
		if(null != user && user.equals("wangxj")) {
			BookService service = new BookService();
			this.setBooks(service.getBooks());
			return SUCCESS;
		}else {
			System.out.println("===================return to login==============================");
			return LOGIN;
		}
	}
}
